﻿#include "MaterialFloatNodeView.h"
#include "MaterialFloatNodeViewModel.h"

#include "Framework/Editor.h"
#include "Theme/EditorTheme.h"

#include "Widgets/Widget.h"
#include "Widgets/TextWidget.h"
#include "Widgets/RectangleWidget.h"
#include "Widgets/Mouse/MouseWidget.h"
#include "Widgets/EditorDragableSpinWidget.h"
#include "Widgets/ImageWidget.h"

#include "Asset/EditorDefaultPackage.h"

#include "MaterialGraph/Pin/MaterialGraphPinView.h"

void RMaterialFloatNodeView::BindViewModel(TSharedObjectPtr<RMaterialGraphNodeViewModel> InModel)
{
    Super::BindViewModel(InModel);
    FloatViewModel=InModel;
    OutputPinView=OutputPinViews[0];
}

void RMaterialFloatNodeView::RegenerateContentWidget()
{
    Super::RegenerateContentWidget();

    int64_t Line=1;
    if(FloatViewModel->IsParameter())
    {
        Line=2;
    }

    auto OutputLine=CreateSimpleOutputPinWidget(RootWidget,RootWidget,0,Line);
    Line++;

    auto ValueLine=CreateVector1DWidgetWithoutLimit(RootWidget,RootWidget,Line
        ,[this](){
            return FloatViewModel->GetValue();
        }
        ,[this](float InValue){
            FloatViewModel->SetValue(InValue);
        }
    );
    Line++;

}
